//
//  Xitongxiaoxi.m
//  WeiDuYY
//
//  Created by 张继良 on 2019/1/24.
//  Copyright © 2019 W ke杨. All rights reserved.
//

#import "Xitongxiaoxi.h"
#import <SDAutoLayout.h>
#import "MeViewController.h"

@interface Xitongxiaoxi ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView * tableView;
@property(nonatomic,strong)NSMutableArray * dataSource;

@end
static NSString *tbvYYcell = @"123";

@implementation Xitongxiaoxi

- (void)viewDidLoad {
    [super viewDidLoad];
    //主界面颜色
    self.view.backgroundColor = [UIColor whiteColor];
    //添加
    [self.view addSubview:self.tableView];
    //方法
    [self setNav];
    //初始化数据源
    self.dataSource = [[NSMutableArray alloc]init];
}
-(void)setNav{
    //按钮
    UIButton *btn1 = [[UIButton alloc] init];
    //添加
    [self.view addSubview:btn1];
   // btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
     //[self.tableView addSubview:btn1];
    btn1.sd_layout.leftSpaceToView(self.view, 20).topSpaceToView(self.view, 650).widthIs(60).heightIs(60);
    [btn1 setImage:[UIImage imageNamed:@"com_icon_my_default_hdpi"] forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(buttonone) forControlEvents:UIControlEventTouchUpInside];
    [btn1 sendSubviewToBack:_tableView];
}

-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
        //数据源和代理
        _tableView.delegate =self;
        _tableView.dataSource = self;
    }
    //表格注册

    return _tableView;
}

//-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
//    return 1;
//}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
//    return _dataSource.count;
    return 7;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:tbvYYcell];
    if (!cell ) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:tbvYYcell];
    }
    _tableView.rowHeight = 80;
    //主标题
    NSArray * arr1 = @[@"购票信息",@"电影信息",@"提醒信息",@"购票信息",@"电影信息",@"提醒信息",@"购票信息"];
    cell.textLabel.text = arr1[indexPath.row];
    //副标题
    NSArray * arr2 = @[@"您已成功订购两张电影票!",@"有两部新电影即将上映",@"您购买的电影将于两小时后放映,请提前到达.",@"您已成功订购两张电影票!",@"有两部新电影即将上映",@"您购买的电影将于两小时后放映,请提前到达.",@"您已成功订购两张电影票!"];
    cell.detailTextLabel.text = arr2[indexPath.row];
    //label
    NSArray * arr3 = @[@"08:00",@"08:00",@"08:00",@"08:00",@"08:00",@"08:00",@"08:00"];
    UILabel * lb1 = [[UILabel alloc]initWithFrame:CGRectMake(350, 35, 50, 30)];
    lb1.text = arr3[indexPath.row];
    lb1.textColor = [UIColor lightGrayColor];
    lb1.font = [UIFont systemFontOfSize:13];
    //取消 cell 选中背景色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [cell addSubview:lb1];
    
    return cell;
}

//隐藏导航条方法
-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;
}
-(void)viewDidDisappear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;
}

-(void)buttonone{
    NSLog(@"134");
    MeViewController * M = [[MeViewController alloc]init];
    [self.navigationController popViewControllerAnimated:YES];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 20;
}
//返回每组头部view
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headerView = [[UIView alloc]init];
    headerView.backgroundColor =[UIColor whiteColor];
    UILabel *label = [[UILabel alloc]init];
    label.textColor = [UIColor blackColor];
    label.font = [UIFont systemFontOfSize:17];
    label.frame = CGRectMake(15, 6, 300, 20);
    label.text = @"系统消息 (三条未读)";
    [headerView addSubview:label];
    
    return headerView;
}



@end
